package com.mm.scheme.domian.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

/**
 * @BelongsProject: chatgpt-java-develop
 * @BelongsPackage: com.unfbx.model
 * @Author : 游在海里的鱼
 * @CreateTime : 2024-03-17  16:04
 * @Version : 1.0
 * @ClassName : 模板
 * @Description : TODO
 */
@Data
@TableName("t_template")
public class Template {
    //编号
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    //用户id
    private Long uid;
    //标题
    private String title;
    //正文
    private String content;
    //状态 0存在,1删除
    private Byte state;
    //创建时间
    @JsonFormat( pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @TableField(value = "createTime")
    private Date createTime;
    //修改时间
    @JsonFormat( pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @TableField(value = "updateTime")
    private Date updateTime;
    
    public void setAll(Template template){
        if(template.getId() != null){
            id = template.getId();
        }
        if(template.getUid() != null){
            uid = template.getUid();
        }
        if(template.getTitle() != null){
            title = template.getTitle();
        }
        if(template.getContent() != null){
            content = template.getContent();
        }
        if(template.getCreateTime() != null){
            createTime = template.getCreateTime();
        }
        if(template.getUpdateTime() != null){
            updateTime = template.getUpdateTime();
        }
    }
}
